3.880 \(\int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx\)

Optimal. Leaf size=206 \[ -\frac{b d^2 \left (3 a^2-b^2\right ) (d \cot (e+f x))^{n-2} \, _2F_1\left (1,\frac{n-2}{2};\frac{n}{2};-\cot ^2(e+f x)\right )}{f (2-n)}-\frac{a d \left (a^2-3 b^2\right ) (d \cot (e+f x))^{n-1} \, _2F_1\left (1,\frac{n-1}{2};\frac{n+1}{2};-\cot ^2(e+f x)\right )}{f (1-n)}+\frac{a^2 d^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{f (1-n)}+\frac{a^2 b d^2 (1-2 n) (d \cot (e+f x))^{n-2}}{f (1-n) (2-n)} \]

[Out]

(a^2*b*d^2*(1 - 2*n)*(d*Cot[e + f*x])^(-2 + n))/(f*(1 - n)*(2 - n)) + (a^2*d^2*(d*Cot[e + f*x])^(-2 + n)*(b +
a*Cot[e + f*x]))/(f*(1 - n)) - (b*(3*a^2 - b^2)*d^2*(d*Cot[e + f*x])^(-2 + n)*Hypergeometric2F1[1, (-2 + n)/2,
 n/2, -Cot[e + f*x]^2])/(f*(2 - n)) - (a*(a^2 - 3*b^2)*d*(d*Cot[e + f*x])^(-1 + n)*Hypergeometric2F1[1, (-1 +
n)/2, (1 + n)/2, -Cot[e + f*x]^2])/(f*(1 - n))

________________________________________________________________________________________

Rubi [A]  time = 0.428232, antiderivative size = 206, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 6, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.261, Rules used = {3673, 3566, 3630, 3538, 3476, 364} \[ -\frac{b d^2 \left (3 a^2-b^2\right ) (d \cot (e+f x))^{n-2} \, _2F_1\left (1,\frac{n-2}{2};\frac{n}{2};-\cot ^2(e+f x)\right )}{f (2-n)}-\frac{a d \left (a^2-3 b^2\right ) (d \cot (e+f x))^{n-1} \, _2F_1\left (1,\frac{n-1}{2};\frac{n+1}{2};-\cot ^2(e+f x)\right )}{f (1-n)}+\frac{a^2 d^2 (a \cot (e+f x)+b) (d \cot (e+f x))^{n-2}}{f (1-n)}+\frac{a^2 b d^2 (1-2 n) (d \cot (e+f x))^{n-2}}{f (1-n) (2-n)} \]

Antiderivative was successfully verified.

[In]

Int[(d*Cot[e + f*x])^n*(a + b*Tan[e + f*x])^3,x]

[Out]

(a^2*b*d^2*(1 - 2*n)*(d*Cot[e + f*x])^(-2 + n))/(f*(1 - n)*(2 - n)) + (a^2*d^2*(d*Cot[e + f*x])^(-2 + n)*(b +
a*Cot[e + f*x]))/(f*(1 - n)) - (b*(3*a^2 - b^2)*d^2*(d*Cot[e + f*x])^(-2 + n)*Hypergeometric2F1[1, (-2 + n)/2,
 n/2, -Cot[e + f*x]^2])/(f*(2 - n)) - (a*(a^2 - 3*b^2)*d*(d*Cot[e + f*x])^(-1 + n)*Hypergeometric2F1[1, (-1 +
n)/2, (1 + n)/2, -Cot[e + f*x]^2])/(f*(1 - n))

Rule 3673

Int[(cot[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_.))^(p_.), x_Symbol] :> Dist
[d^(n*p), Int[(d*Cot[e + f*x])^(m - n*p)*(b + a*Cot[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x
] &&  !IntegerQ[m] && IntegersQ[n, p]

Rule 3566

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Si
mp[(b^2*(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[e + f*x])^(n + 1))/(d*f*(m + n - 1)), x] + Dist[1/(d*(m + n -
1)), Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + f*x])^n*Simp[a^3*d*(m + n - 1) - b^2*(b*c*(m - 2) + a*d*(
1 + n)) + b*d*(m + n - 1)*(3*a^2 - b^2)*Tan[e + f*x] - b^2*(b*c*(m - 2) - a*d*(3*m + 2*n - 4))*Tan[e + f*x]^2,
 x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0]
&& IntegerQ[2*m] && GtQ[m, 2] && (GeQ[n, -1] || IntegerQ[m]) &&  !(IGtQ[n, 2] && ( !IntegerQ[m] || (EqQ[c, 0]
&& NeQ[a, 0])))

Rule 3630

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(C*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])
^m*Simp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0]
&&  !LeQ[m, -1]

Rule 3538

Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c, Int[(b*T
an[e + f*x])^m, x], x] + Dist[d/b, Int[(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ
[c^2 + d^2, 0] &&  !IntegerQ[2*m]

Rule 3476

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[b/d, Subst[Int[x^n/(b^2 + x^2), x], x, b*Tan[c + d
*x]], x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 364

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(a^p*(c*x)^(m + 1)*Hypergeometric2F1[-
p, (m + 1)/n, (m + 1)/n + 1, -((b*x^n)/a)])/(c*(m + 1)), x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] &&
 (ILtQ[p, 0] || GtQ[a, 0])

Rubi steps

\begin{align*} \int (d \cot (e+f x))^n (a+b \tan (e+f x))^3 \, dx &=d^3 \int (d \cot (e+f x))^{-3+n} (b+a \cot (e+f x))^3 \, dx\\ &=\frac{a^2 d^2 (d \cot (e+f x))^{-2+n} (b+a \cot (e+f x))}{f (1-n)}+\frac{d^2 \int (d \cot (e+f x))^{-3+n} \left (b d \left (b^2 (1-n)-a^2 (2-n)\right )-a \left (a^2-3 b^2\right ) d (1-n) \cot (e+f x)+a^2 b d (1-2 n) \cot ^2(e+f x)\right ) \, dx}{1-n}\\ &=\frac{a^2 b d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{a^2 d^2 (d \cot (e+f x))^{-2+n} (b+a \cot (e+f x))}{f (1-n)}+\frac{d^2 \int (d \cot (e+f x))^{-3+n} \left (-b \left (3 a^2-b^2\right ) d (1-n)-a \left (a^2-3 b^2\right ) d (1-n) \cot (e+f x)\right ) \, dx}{1-n}\\ &=\frac{a^2 b d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{a^2 d^2 (d \cot (e+f x))^{-2+n} (b+a \cot (e+f x))}{f (1-n)}-\left (a \left (a^2-3 b^2\right ) d^2\right ) \int (d \cot (e+f x))^{-2+n} \, dx-\left (b \left (3 a^2-b^2\right ) d^3\right ) \int (d \cot (e+f x))^{-3+n} \, dx\\ &=\frac{a^2 b d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{a^2 d^2 (d \cot (e+f x))^{-2+n} (b+a \cot (e+f x))}{f (1-n)}+\frac{\left (a \left (a^2-3 b^2\right ) d^3\right ) \operatorname{Subst}\left (\int \frac{x^{-2+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{f}+\frac{\left (b \left (3 a^2-b^2\right ) d^4\right ) \operatorname{Subst}\left (\int \frac{x^{-3+n}}{d^2+x^2} \, dx,x,d \cot (e+f x)\right )}{f}\\ &=\frac{a^2 b d^2 (1-2 n) (d \cot (e+f x))^{-2+n}}{f (1-n) (2-n)}+\frac{a^2 d^2 (d \cot (e+f x))^{-2+n} (b+a \cot (e+f x))}{f (1-n)}-\frac{b \left (3 a^2-b^2\right ) d^2 (d \cot (e+f x))^{-2+n} \, _2F_1\left (1,\frac{1}{2} (-2+n);\frac{n}{2};-\cot ^2(e+f x)\right )}{f (2-n)}-\frac{a \left (a^2-3 b^2\right ) d (d \cot (e+f x))^{-1+n} \, _2F_1\left (1,\frac{1}{2} (-1+n);\frac{1+n}{2};-\cot ^2(e+f x)\right )}{f (1-n)}\\ \end{align*}

Mathematica [A]  time = 0.836421, size = 141, normalized size = 0.68 \[ \frac{\tan ^2(e+f x) (d \cot (e+f x))^n \left (a \left ((n-2) \left (a^2-3 b^2\right ) \cot (e+f x) \, _2F_1\left (1,\frac{n-1}{2};\frac{n+1}{2};-\cot ^2(e+f x)\right )+a (-a (n-2) \cot (e+f x)-3 b (n-1))\right )-b (n-1) \left (b^2-3 a^2\right ) \, _2F_1\left (1,\frac{n-2}{2};\frac{n}{2};-\cot ^2(e+f x)\right )\right )}{f (n-2) (n-1)} \]

Antiderivative was successfully verified.

[In]

Integrate[(d*Cot[e + f*x])^n*(a + b*Tan[e + f*x])^3,x]

[Out]

((d*Cot[e + f*x])^n*(-(b*(-3*a^2 + b^2)*(-1 + n)*Hypergeometric2F1[1, (-2 + n)/2, n/2, -Cot[e + f*x]^2]) + a*(
a*(-3*b*(-1 + n) - a*(-2 + n)*Cot[e + f*x]) + (a^2 - 3*b^2)*(-2 + n)*Cot[e + f*x]*Hypergeometric2F1[1, (-1 + n
)/2, (1 + n)/2, -Cot[e + f*x]^2]))*Tan[e + f*x]^2)/(f*(-2 + n)*(-1 + n))

________________________________________________________________________________________

Maple [F]  time = 0.322, size = 0, normalized size = 0. \begin{align*} \int \left ( d\cot \left ( fx+e \right ) \right ) ^{n} \left ( a+b\tan \left ( fx+e \right ) \right ) ^{3}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x)

[Out]

int((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x)

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \tan \left (f x + e\right ) + a\right )}^{3} \left (d \cot \left (f x + e\right )\right )^{n}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

integrate((b*tan(f*x + e) + a)^3*(d*cot(f*x + e))^n, x)

________________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left ({\left (b^{3} \tan \left (f x + e\right )^{3} + 3 \, a b^{2} \tan \left (f x + e\right )^{2} + 3 \, a^{2} b \tan \left (f x + e\right ) + a^{3}\right )} \left (d \cot \left (f x + e\right )\right )^{n}, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

integral((b^3*tan(f*x + e)^3 + 3*a*b^2*tan(f*x + e)^2 + 3*a^2*b*tan(f*x + e) + a^3)*(d*cot(f*x + e))^n, x)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (d \cot{\left (e + f x \right )}\right )^{n} \left (a + b \tan{\left (e + f x \right )}\right )^{3}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cot(f*x+e))**n*(a+b*tan(f*x+e))**3,x)

[Out]

Integral((d*cot(e + f*x))**n*(a + b*tan(e + f*x))**3, x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \tan \left (f x + e\right ) + a\right )}^{3} \left (d \cot \left (f x + e\right )\right )^{n}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*cot(f*x+e))^n*(a+b*tan(f*x+e))^3,x, algorithm="giac")

[Out]

integrate((b*tan(f*x + e) + a)^3*(d*cot(f*x + e))^n, x)